<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>四级学习网站</title>
    <script src="/static/jquery.js" type="text/javascript"></script>

    <link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="/static/font-awesome.min.css" rel="stylesheet">
    <script>
        function playMusic(path) {
            var audioEle = document.getElementById("audio");
            audioEle.src = path;
            audioEle.load();
            if (audioEle.paused) {
                /*如果已经暂停*/
                audioEle.play(); //播放
            } else {
                audioEle.pause(); //暂停
            }
        }
    function knowword(danciid){
        $.get("{:url('knowword')}",{"danciid":danciid},function(data){
            alert(data);
            $("#id_"+danciid).parent().hide();
        });
    }
    </script>
</head>

<body>
    <div class="container">
        <br>
        <br>
        <br>
        <br>
        <br>
        <form class="form-horizontal1  col-md-12">
            <div class="col-md-11">
                <input type="text" class="form-control" name="word" placeholder="Text words">

            </div>
            <span class="">
                <button type="submit" class="btn btn-primary ">
                    搜索<span class="glyphicon glyphicon-search " aria-hidden="true"></span>
                </button>
            </span>
            <div class="clearfix"></div>

        </form>
        <br>
        <p>共找到{$result|count}个单词</p>
        <hr>
        <div id="result">
            {volist name="result" id="danci"}
            <div id="w_{$danci.words}" class="col-md-3">
                <a type="button" class="btn btn-primary" title="{$danci.spell}">{$danci.words}</a>
                <button type="button" class="btn btn-default btn-sm" onmousedown='$("#id_{$danci.id}").toggle();'>
                    <span class="glyphicon glyphicon-asterisk" aria-hidden="true"></span>
                </button>
                <button type="button" class="btn btn-default btn-sm" onclick='playMusic("{$danci.audio}");'>
                    <span class="glyphicon glyphicon-play-circle " aria-hidden="true"></span>
                </button>
                <button type="button" class="btn btn-default btn-sm" onclick='knowword("{$danci.id}");'>
                    <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
                </button>
                <div id="id_{$danci.id}" style="display:none;">
                    <ul class="list-unstyled">
                        {$danci.means}
                    </ul>
                </div>
                <hr>
            </div>
            {/volist}
        </div>



    </div>
    <audio id="audio" src=""></audio>
</body>

</html>